#pragma once

#include "CTransformer.h"
#include "CMILMatrix4x4.h"
#include "XVERTEX25D.h"
class CPerspectiveTransformer :
	public CTransformer
{

public: 
	CPerspectiveTransformer(const CMILMatrix4x4 & matProjection, const struct XVERTEX25D & vTopLeft, const struct XVERTEX25D & vOneDx, const struct XVERTEX25D & vOneDy, XBOOL fIsSingular);
protected: 
	virtual ~CPerspectiveTransformer();
public: 
	HRESULT TransformCheckW(const struct XPOINTF * pSrcPoints, struct XPOINTF * pDestPoints, XUINT32 uiCount, XBOOL * pAreAllWValuesPositive);
	HRESULT Transform(const struct XPOINTF4 * pSrcPoints, struct XPOINTF4 * pDestPoints, XUINT32 uiCount);
	virtual HRESULT Transform(const struct XPOINTF * pSrcPoints, struct XPOINTF * pDestPoints, XUINT32 uiCount);
	void CopySource(const struct XPOINTF4 & source, struct XPOINTF * pDestination);
	void CopySource(const struct XPOINTF & source, struct XPOINTF * pDestination);
	void SaveDestination(const struct XVERTEX25D & source, struct XPOINTF4 * pDestination);
	void SaveDestination(const struct XVERTEX25D & source, struct XPOINTF * pDestination);
	virtual HRESULT ReverseTransform(const struct XPOINTF * pSrcPoints, struct XPOINTF * pDestPoints, XUINT32 uiCount);
	virtual enum ITransformer::TransformerType GetType();
	XBOOL IsInvertible();
private: 
	CMILMatrix4x4 m_matProjection;  
	struct XVERTEX25D m_vTopLeft; 
	struct XVERTEX25D m_vOneDx; 
	struct XVERTEX25D m_vOneDy; 
	XBOOL m_fIsSingular;

};